import axios from "axios";
import {save_nav_data} from "./constants";

//请求导航的数据
export const requestNavData = () => {

    return (dispatch) => {
        axios.get("/navi/json")
            .then((res) => {
                console.log("请求导航数据成功");
                console.log(res.data);
                const data = res.data.data;
                const action = saveNavData(data);
                dispatch(action);
            })
    }
};

//保存数据
const saveNavData = (data) => ({
    type: save_nav_data,
    data: data
});


